package com.siyougame.business.controller.admin.inspectItem;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.siyougame.business.service.inspectItemImg.InspectItemImgService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;

import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import com.siyougame.common.pojo.PageResult;
import com.siyougame.common.pojo.CommonResult;
import static com.siyougame.common.pojo.CommonResult.success;

import com.siyougame.common.utils.ExcelUtils;

import com.siyougame.common.annotation.OperateLog;
import static com.siyougame.common.enums.OperateTypeEnum.*;

import com.siyougame.business.controller.admin.inspectItem.vo.*;
import com.siyougame.business.dal.dataobject.inspectItem.InspectItemDO;
import com.siyougame.business.convert.inspectItem.InspectItemConvert;
import com.siyougame.business.service.inspectItem.InspectItemService;

@Api(tags = "管理后台 - 检查记录明细")
@RestController
@RequestMapping("/openapi/business/inspect-item")
@Validated
public class InspectItemController {

    @Resource
    private InspectItemService inspectItemService;
    @Resource
    private InspectItemImgService inspectItemImgService;
    //@PostMapping("/create")
    //@ApiOperation("创建检查记录明细")
    //@PreAuthorize("@ss.hasPermi('business:inspect-item:create')")
    //public CommonResult<Long> createInspectItem(@Valid @RequestBody InspectItemCreateReqVO createReqVO) {
    //    return success(inspectItemService.createInspectItem(createReqVO));
    //}
    //
    @PutMapping("/update")
    @ApiOperation("更新检查记录明细")
    public CommonResult<Boolean> updateInspectItem(@Valid @RequestBody InspectItemUpdateReqVO updateReqVO) {
        inspectItemService.updateInspectItem(updateReqVO);
        return success(true);
    }
    //
    //@DeleteMapping("/delete")
    //@ApiOperation("删除检查记录明细")
    //@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
    //@PreAuthorize("@ss.hasPermi('business:inspect-item:remove')")
    //public CommonResult<Boolean> deleteInspectItem(@RequestParam("id") Long id) {
    //    inspectItemService.deleteInspectItem(id);
    //    return success(true);
    //}
    //
    //@GetMapping("/get")
    //@ApiOperation("获得检查记录明细")
    //@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
    //@PreAuthorize("@ss.hasPermi('business:inspect-item:query')")
    //public CommonResult<InspectItemRespVO> getInspectItem(@RequestParam("id") Long id) {
    //    InspectItemDO inspectItem = inspectItemService.getInspectItem(id);
    //    return success(InspectItemConvert.INSTANCE.convert(inspectItem));
    //}
    //
    //@GetMapping("/list")
    //@ApiOperation("获得检查记录明细列表")
    //@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
    //@PreAuthorize("@ss.hasPermi('business:inspect-item:query')")
    //public CommonResult<List<InspectItemRespVO>> getInspectItemList(@RequestParam("ids") Collection<Long> ids) {
    //    List<InspectItemDO> list = inspectItemService.getInspectItemList(ids);
    //    return success(InspectItemConvert.INSTANCE.convertList(list));
    //}

    @GetMapping("/page")
    @ApiOperation("获得检查记录明细分页")
    public CommonResult<PageResult<InspectItemRespVO>> getInspectItemPage(@Valid InspectItemPageReqVO pageVO) {

        return success(inspectItemService.getInspectItemPage(pageVO));
    }

    //@GetMapping("/export-excel")
    //@ApiOperation("导出检查记录明细 Excel")
    //@PreAuthorize("@ss.hasPermi('business:inspect-item:export')")
    //@OperateLog(type = EXPORT)
    //public void exportInspectItemExcel(@Valid InspectItemExportReqVO exportReqVO,
    //          HttpServletResponse response) throws IOException {
    //    List<InspectItemDO> list = inspectItemService.getInspectItemList(exportReqVO);
    //    // 导出 Excel
    //    List<InspectItemExcelVO> datas = InspectItemConvert.INSTANCE.convertList02(list);
    //    ExcelUtils.write(response, "检查记录明细.xls", "数据", InspectItemExcelVO.class, datas);
    //}

}
